﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;

namespace 影片售票系统
{
    public partial class wangji : Form
    {
        int CurrentCheckNo = 0;

        public wangji()
        {
            InitializeComponent();
        }
        //public int k = 0;  
        //int number = 0;
        string verifyCode = string.Empty;//验证字符
        private void RefrashVerifyCodeSimple()
        {
            wj code = new wj();
            verifyCode = code.GreateVerifyCode(5);
            pictureBox1.Image = code.GreateImage(verifyCode, 15, "楷体", Color.Blue, Color.White);
        }

        // code.GreateImage(verifyCode, 15, "楷体", Color.Blue, Color.White);
        private void wangji_Load(object sender, EventArgs e)
        {
            RefrashVerifyCodeSimple();
            label4.BackColor = Color.Transparent;

            //Random r = new Random();
            ////r.Next(100, 1000);
            //int value = r.Next(100, 1000);
            ////r.Next(0, this.Width);
            //textBox5.Text = r.Next().ToString();
            //Random rnd = new Random();
            //CurrentCheckNo  = rnd.Next(100000, 999999);
            //this.button1.Text = CurrentCheckNo.ToString();
        }

        private void button2_Click(object sender, EventArgs e)
        {
            //int yzm =Convert.ToInt32(this.textBox2.Text);
            int dianhua = Convert.ToInt32(this.textBox1.Text);
            int mima = Convert.ToInt32(this.textBox3.Text);

            if (textBox3.TextLength < 6 || textBox4.TextLength > 16)
            {
                MessageBox.Show("密码不符合标准！", "提示");
                return;
            }
            if (textBox3.Text != textBox4.Text)
            {
                MessageBox.Show("二次密码不一致，请重新输入！", "提示");
                textBox3.Text = "";
                textBox4.Text = "";
                return;
            }
          
            string sql = string.Format("select * from YH_1 where dianhua = {0}and mima={1}", dianhua, mima);
            DataTable read = common.DBHelper.read(sql);
            if (read.Rows.Count > 0)
            {
                MessageBox.Show("恭喜您登录成功");
            }
            else
            {
                MessageBox.Show("您失败了哟..在想想");
            }
        }
 
        private void pictureBox1_Click(object sender, EventArgs e)
        {
         RefrashVerifyCodeSimple();
        }

        //    

        //private void textBox5_TextChanged(object sender, EventArgs e)
        //{


        //}

        //private void textBox2_TextChanged(object sender, EventArgs e)
        //{

            //if (textBox2 == ChkNO)
            //{
            //    MessageBox.Show("");
            //}
            //else
            //{
            //    MessageBox.Show("验证码不匹配");

            //}
            //string ChkNO = button1.Text;
            //if (!this.CurrentCheckNo.ToString().Equals(ChkNO))
            //{
            //    MessageBox.Show("验证码不匹配");
            //    return;
        //    //}
        //}
    }
 }
    

